<template>
  <div class="select" v-show="show" ref="select">
    <van-picker
      show-toolbar
      :columns="columns"
      @confirm="onConfirm"
      @cancel="onCancel"
    />
  </div>
</template>

<script>
import EventBus from "@/eventBus"
export default {
    mounted(){
        EventBus.$on('sendShow',val=>{this.show = val});
        // this.$refs.select.style.transform = "translateY(-50%)"
    },
  data() {
    return {
      columns: ["全部商品", "女装", "男装", "鞋类", "内衣", "母婴"],
      show: false,
      val: ""
    };
  },
  methods: {
    onConfirm(value) {
      this.val = value;
      EventBus.$emit('sendVal',this.val)
      this.show = false
    },
    onCancel() {
      this.show = false
    },
  },
};
</script>

<style>
.van-picker__cancel,.van-picker__confirm{
  color: rgb(204, 69, 69);
}
</style>
